(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/resources/Script/Ssg/Cache/SystemInfo.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'f2e93iE8hhBbY7ARieWep4j', 'SystemInfo', __filename);
// resources/Script/Ssg/Cache/SystemInfo.js

"use strict";

window.SystemInfo = function () {

    var _static = {
        platform: null, //运行平台
        logInfo: "INFO", //日志级别， INFO /DEBUG /NONE /ERROR
        gameQuery: null, //进游戏带的参数
        isRunning: false, //是否在游戏中
        runInIphoneX: false, //是否在iphoneX平台上运行

        /**
         * 设置平台
         */
        setPlatform: function setPlatform() {
            //暂时只做简单判断，wx/other
            if (cc.sys.platform == cc.sys.MACOS) {
                this.platform = "macOs";
            } else if (cc.sys.platform == cc.sys.ANDROID) {
                this.platform = "android";
            } else if (cc.sys.platform == cc.sys.IPHONE) {
                this.platform = "iphone";
            } else if (cc.sys.platform == cc.sys.IPAD) {
                this.platform = "ipad";
            } else if (cc.sys.platform == cc.sys.MOBILE_BROWSER) {
                this.platform = "mobileBrowser"; //手机流浪器
            } else if (cc.sys.platform == cc.sys.DESKTOP_BROWSER) {
                this.platform = "desktopBrowser"; //桌面流浪器
            } else if (cc.sys.platform == cc.sys.WECHAT_GAME) {
                if (cc.sys.browserType == cc.sys.BROWSER_TYPE_WECHAT_GAME) {
                    this.platform = "weChatGame";
                } else {
                    this.platform = "weChat";
                }
            } else if (cc.sys.platform == cc.sys.QQ_PLAY) {
                if (cc.sys.browserType == cc.sys.BROWSER_TYPE_QQ_PLAY) {
                    this.platform = "qqPlay";
                }
            }
            Log.info("cc.sys.platform:", cc.sys.platform);
            Log.info("当前运行平台是", this.platform);
        },

        getPlatform: function getPlatform() {
            return this.platform;
        },

        /**
         * 本地缓存
         * @param key
         * @param value
         */
        setLocalStorage: function setLocalStorage(key, value) {
            cc.sys.localStorage.setItem(key, String(value));
            Log.debug("设置本地存储 key:" + key, "value:" + value);
        },

        getLocalStorage: function getLocalStorage(key, defaultValue) {
            var value = cc.sys.localStorage.getItem(key);
            if (!value) {
                return defaultValue;
            }
            return value;
        },

        /**
         * 日志级别
         * @returns {*}
         */
        getLogInfo: function getLogInfo() {
            return this.logInfo;
        },

        setLogInfo: function setLogInfo(loginfo) {
            this.logInfo = loginfo;
        },

        /**
         * 进入游戏的次数
         */
        addGameStartTime: function addGameStartTime() {
            var gameTime = this.getLocalStorage("GameStartTime", "0");
            this.setLocalStorage("GameStartTime", (parseInt(gameTime) + 1).toString());
        },

        getGameStartTime: function getGameStartTime() {
            return this.getLocalStorage("GameStartTime", "0");
        },

        /**
         * 开始游戏的次数
         */
        addGameRuningTime: function addGameRuningTime() {
            var gameTime = this.getLocalStorage("GameRuningTime", "0");
            this.setLocalStorage("GameRuningTime", (parseInt(gameTime) + 1).toString());
        },

        getGameRuningTime: function getGameRuningTime() {
            return this.getLocalStorage("GameRuningTime", "0");
        },

        /**
         * 获取游戏中状态
         * @param isRunning
         */
        setIsRunning: function setIsRunning(isRunning) {
            this.isRunning = isRunning;
        },
        getIsRunning: function getIsRunning() {
            return this.isRunning;
        },

        setIsOpenMusic: function setIsOpenMusic(isOpenMusic) {
            this.setLocalStorage("isOpenMusic", isOpenMusic);
        },
        getIsOpenMusic: function getIsOpenMusic() {
            return this.getLocalStorage("isOpenMusic", "true");
        },

        /**
         * 进游戏带的参数
         * @param gameQuery
         */
        setGameQuery: function setGameQuery(gameQuery) {
            this.gameQuery = gameQuery;
        },

        getGameQuery: function getGameQuery() {
            return this.gameQuery;
        },

        setRunInIphoneX: function setRunInIphoneX(runInIphoneX) {
            this.runInIphoneX = runInIphoneX;
        },

        getRunInIphoneX: function getRunInIphoneX() {
            return runInIphoneX;
        }

    };
    return _static;
}();

module.exports = SystemInfo;

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=SystemInfo.js.map
        